﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;


namespace CodeStash.Addin.Helpers
{
    public class TaskHelper
    {
        public static Task<bool> CreateDelayTask(int milliSecondsTimeout)
        {
	        TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
	        new Timer(self => 
	        {
		        ((IDisposable)self).Dispose();
		        tcs.TrySetResult(true);
	        }).Change(milliSecondsTimeout, -1);
	        return tcs.Task;
        }
    }
}
